package org.example;

import org.example.config.SpringConfig;
import org.example.dao.UserDao;
import org.example.dao.impl.StudentDaoimpl;
import org.example.dao.impl.UserDaoimpl;
import org.example.service.StudentService;
import org.example.service.impl.UserServiceimpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import java.sql.SQLException;

/**
 * 通过通过加载配置SpringConfig类
 *
 */
public class App {
    public static void main( String[] args ) throws SQLException {
        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);//通过加载配置SpringConfig类
//        StudentService studentService = (StudentService) context.getBean("studentService");
////        System.out.println("studentService = " + studentService);
////        studentService.Save();
        UserServiceimpl userService= (UserServiceimpl) context.getBean("userService");
        userService.Save();

    }
}
